package com.xy.netutils.net;

import rx.functions.Func1;

/**
 * Created by 向阳 on 2016/11/21.
 * email：yang.xiang@cienet.com.cn
 */

public class HttpResultFunc<T> implements Func1<BaseData<T>, T> {
    @Override
    public T call(BaseData<T> baseData) {
        if (baseData.getStatus()!=200) {
            try {
                throw new Exception(baseData.getReason());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return baseData.getResult();
    }
}
